<?php

namespace App\Jobs;

use App\W7OpenTracing\Bus\Dispatchable;
use App\W7OpenTracing\Facade;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class TraceJob2 implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {

    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $span = Facade::startSpanCarrier('job2 span1', $this->carrier());
        sleep(1);
        $span2 = Facade::startSpanChildOf('span2', $span->getContext());
        sleep(1);
        $span2->finish();
        sleep(1);
        $span->finish();
        Facade::flush();
    }
}
